package 草稿包;

import java.util.Scanner;
import java.lang.*;

/**
 * TODO
 *
 * @Description
 * @Author Lx
 * @Date 2024/5/18 19:24
 **/
public class Main1 {

    private static int solve1(int a, int b) {
        int result = a ^ b;
        return result == 0 ? 0 : 1;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int m=sc.nextInt();
        for (int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            int result = solve1(a, b);
//            System.out.println(a);
//            System.out.println(b);
            System.out.println(result);
        }
    }
}